int search(int* nums, int numsSize, int target) {
    int left = 0, right = numsSize - 1;
    while (left <= right)
    {
        int middle = (left + right) / 2;
        if (nums[0] < nums[middle])
        {
            if (target < nums[middle])
            {
                right = middle - 1;
            }
        }
        else if (target == nums[middle])
        {
            return middle;
        }
        else
        {
            if (target < nums[middle])
            {
                left = middle + 1;
            }
        }
    }
    return -1;
}

int main()
{
    int arr[7] = { 4,5,6,7,0,1,2 };
    int sz = sizeof(arr) / sizeof(arr[0]);
    int s = search(arr, sz, 0);
    return 0;
}